You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
714 B

import { defineWrappedResponseHandler } from "#server/utils/handler";
import { R } from "#server/utils/response";
import { resolveAgentIdentity } from "#server/service/agent/identity";
import { getSessionByIdAndUser, softDeleteSession } from "#server/service/agent/session";
export default defineWrappedResponseHandler(async (event) => {
const identity = await resolveAgentIdentity(event);
const id = getRouterParam(event, "id");
if (!id) {
return R.error("参数无效", null);
}
const session = await getSessionByIdAndUser(id, identity.userId, identity.tempToken);
if (!session) {
return R.error("会话不存在", null);
}
await softDeleteSession(id);
return R.success({ id });
});